/**
 * Create in 2012-10-12 下午9:41:05.
 */
package kit4j.app.notepad.ui.menu;

import java.awt.MenuItem;
import java.awt.MenuShortcut;
import java.awt.event.KeyEvent;

import kit4j.app.notepad.command.CreateNewNotepadCommand;
import kit4j.app.notepad.command.NotepadCommandExecutor;
import kit4j.app.notepad.config.NotepadConfig;
import kit4j.app.notepad.ui.listener.ExecuteCommandActionListener;

/**
 * 
 * @author MiniKnife
 *
 */
public class CreateNewNotepadMenuItem extends MenuItem {

	private static final long serialVersionUID = 1L;

	public CreateNewNotepadMenuItem(NotepadConfig config, NotepadCommandExecutor commandExecutor) {
		super(config.getString("MENU_NEW_NOTEPAD_LABEL", "New"));
		
		setShortcut(new MenuShortcut(KeyEvent.VK_N, false));
		initActionListener(commandExecutor);
	}
	
	private void initActionListener(NotepadCommandExecutor commandExecutor) {
		addActionListener(new ExecuteCommandActionListener(new CreateNewNotepadCommand(), commandExecutor));
	}
}
